package main

import (
	"fmt"
	"encoding/json"
)

//https://github.com/astaxie/build-web-application-with-golang/blob/master/zh/07.2.md

//{"servers":[{"serverName":"Shanghai_VPN","serverIP":"127.0.0.1"},{"serverName":"Beijing_VPN","serverIP":"127.0.0.2"}]}

type Server struct{
	ServerName string
	ServerIP string
}

type Serverslice struct{
	Servers []Server
}


func main(){
	var s Serverslice
	str:=`{"servers":[{"serverName":"Shanghai_VPN","serverIP":"127.0.0.1"},{"serverName":"Beijing_VPN","serverIP":"127.0.0.2"}]}`
	json.Unmarshal([]byte(str),&s)
	fmt.Println(s)
}